OLE error for only some users

Hi,

We are using DOORS 9.5 and Windows 7. We have customized the Word export using OLE and have been using it successfully for many months. Two recent hires have a problem when they use the script. They get the error message: "CRCRD5311W: An OLE method failed. More information: OLE problem: unable to run the specified OLE macro. OLE error code -2147352537."

When a "good" user logs into a "bad" user's PC (using the good user's login credentials), they do not get the error. When a "bad" user logs into a "good" user's PC, they do get the error. No error if we export to Excel. I created a module with a single object and no data. Same problem. Based on this, it is not a dxl coding error but something else.

We have tried, in this order: delete and reinstall doors (didn't help) then delete and reinstall word (didn't help).

I am still puzzling through the 4k lines of code created by my predecessor so I don't have the triggering dxl snippet. But since it is happening to just two people, I don't think it is code. Any suggestions?

Thanks,

Daniel


anotherDaniel - Wed Feb 22 12:16:30 EST 2017

Re: OLE error for only some users
Richard_Good - Wed Feb 22 12:59:17 EST 2017

This article, seems to be helpful, sounds like it is caused by a preview window in windows explorer - weird!

 

http://www-01.ibm.com/support/docview.wss?uid=swg21598217

 

Re: OLE error for only some users
anotherDaniel - Wed Feb 22 16:13:48 EST 2017

Thank you for pointing this out. I had already checked and eliminated this possibility (when we experimented with good and bad users, there were no word documents on the desktop or in a file manager window).

Re: OLE error for only some users
Mathias Mamsch - Thu Feb 23 15:25:49 EST 2017

anotherDaniel - Wed Feb 22 16:13:48 EST 2017

Thank you for pointing this out. I had already checked and eliminated this possibility (when we experimented with good and bad users, there were no word documents on the desktop or in a file manager window).

Searching for the error message "unable to run the specified OLE macro", there seem to be many possible reasons: 

- typo in the macro name

- startup macros (Normal.dot) still running/loading

- no access to the word template in which the macro resides, 

- etc. 

I think we might not be able to help you here on this one. From the DXL side it seems you have no problem, since the code works for some users. It seems you might be better of in a Word forum asking for possible reasons, why a macro cannot be executed over COM.

I can only propose if running the macro fails, wait a second and retry for 2 times before giving up. Maybe this resolves the issues. 

Regards, Mathias

Re: OLE error for only some users
Wolfgang Uhr - Thu Mar 09 09:41:49 EST 2017

Hi

You should try to run the macro manually from both types of accounts. So you can find you if both uses have the priviledge to run the macro.

Best regards

Wolfgang

Re: OLE error for only some users
anotherDaniel - Mon Mar 13 12:47:15 EDT 2017

Hi,

Thank you everybody for your suggestions. This isn't my code, the original developer is long gone, and I have never worked with OLE before so this was all very new. I have worked through the problem and am documenting it here in case someone else runs into a similar situation. I have simplified the code snippets from the original.

The code shows the name of the macro and the full path to the word template file that has the macro. It turned out that these users did not have read permission to this path whereas all the other users did.

Daniel

#include <utils/ole.inc> // contains checkRes which creates the dialog box with the error message if the OLE call fails

const string cMethodAdd = (NLS_("Add")) // in ole.inc. Added here so you can see
const string cPropertyAttachedTemplate = "AttachedTemplate"

OleAutoObj objDoc = null
OleAutoObj objDocs = null
OleAutoArgs objArgBlock = null

string result
string localTemplateName = "//<server name>/<full path>/<word template>.dot"

//... snip ...

clear(objArgBlock)
put(objArgBlock, localTemplateName)
checkRes(oleMethod(objDocs, cMethodAdd, objArgBlock)) // I think this attaches the template to the file

//... snip ...

// This runs a macro in the template

OleAutoObj objTemplate = null
checkRes(oleGet(objDoc, cPropertyAttachedTemplate, objTemplate)) // I think this makes sure the template is really there

if (!null(objTemplate)) {

    // This calls the macro in the template.
    clear(objArgBlock)
    put(objArgBlock, "<macro name>")
    checkRes(oleMethod(objWord, cMethodRun, objArgBlock)) // this is where it crashes
}